<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>js变量typeof</title>
		<script>
			/*var i = 3;
			alert(i);
			
			i = "abc";
			alert(i);*/
			//定义number类型
			var num = 1;
			var num2 = 1.2;
			var num3 = NaN;
			//输出到页面上
			document.write(num+"----"+typeof(num)+"<br />");
			document.write(num2+"----"+typeof(num2)+"<br />");
			document.write(num3+"----"+typeof(num3)+"<br />");
			
			//定义string类型
			var str = "abc";
			var str1 = 'efg';
			document.write(str+"----"+typeof(str)+"<br />");
			document.write(str1+"----"+typeof(str1)+"<br />");
			
			//定义Boolean类型
			var flag = true;
			document.write(flag+"----"+typeof(flag)+"<br />");
			
			//定义null undefined
			var obj = null;
			var obj1 = undefined;
			var obj2;
			document.write(obj+"----"+typeof(obj)+"<br />");
			document.write(obj1+"----"+typeof(obj1)+"<br />");
			document.write(obj2+"----"+typeof(obj2));
		</script>
	</head>
	<body>
	</body>
</html>
